﻿//window.open打开页面
var _sznmsWindows = []; //将所有的windows窗口保存句柄
function OpenPage(url) {
    _sznmsWindows.push(window.open(url, 'new', 'height=600, width=920,toolbar=no, menubar=no, scrollbars=no, resizable=no,top=160,left=190 location=no, status=yes'));
}
//window.open打开页面，在屏幕居中
//参数：url，要打开的页面的路径
function registerWindow(url) {
    var windowWidth = 700;
    var windowHeight = 500;
    var iWidth = (screen.width - windowWidth) / 2;
    var iHeight = (screen.height - windowHeight) / 2;
    var str = 'width=' + windowWidth + ',height=' + windowHeight + ',left=' + iWidth + ',top=' + iHeight + ',toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=no, status=yes';
    _sznmsWindows.push(window.open(url, 'registerWindow', str));
}
//window.open打开页面，页面居中
/*
参数：url，要打开的页面的路径 
width，弹出页面的宽
height，弹出页面的高
scrollbar，页面都有滚动条，字符串'yes'或'no'（含引号）
*/
function OpenWindow(url, width, height, scrollbar) {
    var windowWidth = width;
    var windowHeight = height;
    var iWidth = (screen.width - windowWidth) / 2;
    var iHeight = (screen.height - windowHeight) / 2;
    var str = 'width=' + windowWidth + ',height=' + windowHeight + ',left=' + iWidth + ',top=' + iHeight + ',toolbar=no, menubar=no, scrollbars=' + scrollbar + ', resizable=yes,location=no, status=yes';
    _sznmsWindows.push(window.open(url, 'registerWindow', str));
}
//window.open打开页面，页面居中
/*
参数：url，要打开的页面的路径 
width，弹出页面的宽
height，弹出页面的高
scrollbar，页面都有滚动条，字符串'yes'或'no'（含引号）
windowname，弹出窗口的名称
*/
function OpenWindowEvery(url, width, height, scrollbar, windowname) {
    var windowWidth = width;
    var windowHeight = height;
    var iWidth = (screen.width - windowWidth) / 2;
    var iHeight = (screen.height - windowHeight) / 2;
    var str = 'width=' + windowWidth + ',height=' + windowHeight + ',left=' + iWidth + ',top=' + iHeight + ',toolbar=no, menubar=no, scrollbars=' + scrollbar + ', resizable=yes,location=no, status=yes';
    _sznmsWindows.push(window.open(url, windowname, str));
}
/*
模态窗口形式弹出
*/
function OpenModalDialog(url, width, height, scrollbar) {
    var windowWidth = width;
    var windowHeight = height;
    var iWidth = (screen.width - windowWidth) / 2;
    var iHeight = (screen.height - windowHeight) / 2;
    var str = 'dialogWidth:' + windowWidth + 'px;dialogHeight:' + windowHeight + 'px;center:yes;status:no;resizable:yes;scroll:no';
    var para = new Array;
    window.showModalDialog(url, para, str);
}
/*
* 全屏显示 弹出窗口
* @param  url 文件路径
* @param  c   是否关闭原窗口，关闭(true),不关闭(false)
*/
function WindowFullScreenTitle(url, c,wName) {
    var height = window.screen.height - 100;
    var width = window.screen.width;
    window.open(url, wName||'fullscreenWindow', 'height='+height +', width='+width +',toolbar=no, menubar=no, scrollbars=no, resizable=no,top=0,left=0,location=no, status=yes');
    if (c) {
        window.opener = null;
        window.close();
    }
}
/*
* 全屏显示 弹出窗口
* @param  url 文件路径
* @param  c   是否关闭原窗口，关闭(true),不关闭(false)
*/
function WindowFullScreen(url, c) {
    window.open(url, 'fullscreenWindow', 'FULLSCREEN=YES,ScrollBars=no');
    if (c) {
        window.opener = null;
        window.close();
    }
}
/*
* 全屏显示 模态对话框
* @param  url 文件路径
*/
function DialogFullScreen(url) {
    window.showModalDialog(url, '', 'dialogWidth=' + window.screen.width + ';dialogHeight=' + window.screen.height);
}